<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

	
	protected function _initAutoload() 
	{
        
        $moduleloader = new Zend_Application_Module_Autoloader ( array ('namespace' => '', 'basePath' => APPLICATION_PATH ) );
        $autoloader = Zend_Loader_Autoloader::getInstance ();
        $autoloader->registerNamespace ( array ('App_' ) );
        return $moduleloader;
    }
    function _initSession() 
    {
        Zend_Session::start ();
    }

    function _initViewHelpers() 
    {
        $this->bootstrap ( 'layout' );
        $layout = $this->getResource ( 'layout' );
        $view = $layout->getView ();
        $view->doctype ( 'XHTML1_TRANSITIONAL' );
        $view->headMeta ()->appendHttpEquiv ( 'Content-Type', 'text/html;charset=utf-8' );
        $view->headTitle ()->setSeparator ( ' - ' );
        $view->headTitle ( 'MonitoraSUS' );
        
        $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
                    'ViewRenderer'
        );
        $viewRenderer->setView($view);      
    }
    public function _initDbAdapter() {
        $this->bootstrap ( 'db' );
        $dbAdapter = $this->getResource ( 'db' );
        
        Zend_Registry::set ( 'db', $dbAdapter );
    
    }


    protected function _initMenu() {
        $pages = array(
                    array(
                    'label' => 'Indicadores',
                    'module' => 'default',
                    'controller' => 'indicadores',
                    'action' => 'index',
                    'class'=>'ui-corner-all ',
                    'id'    => 'root',
                    'pages' => array(
                                    array(
                                        'label' => 'Listar',
                                        'module' => 'default',
                                        'controller' => 'indicadores',
                                        'action' => 'index',
                                        'class'=>'ui-corner-all',
                                        'id'    => 'm2'
                                    ),
                                    array(
                                        'label' => 'Calcular',
                                        'module' => 'default',
                                        'controller' => 'indicadores',
                                        'action' => 'calcular',
                                        'class'=>'ui-corner-all',
                                        'id'    => 'm3'
                                    )
                                )
                    ),
                    array(
	                    'label' => 'Administrador',
	                    'module' => 'default',
	                    'controller' => 'index',
	                    'action' => 'index',
	                    'class'=>'ui-corner-all ',
                        'id'    =>  'aroot',
	                    'pages' => array(
	                                    array(
	                                        'label' => 'Instruções SQL',
	                                        'module' => 'default',
	                                        'controller' => 'instrucoes',
	                                        'action' => 'index',
	                                        'class'=>'ui-corner-all',
	                                        'id'       => 'a1'
	                                    ),
                                    array(
                                        'label' => 'Sistemas',
                                        'module' => 'default',
                                        'controller' => 'sistemas',
                                        'action' => 'index',
                                        'class'=>'ui-corner-all',
                                        'id'    => 'm5'
                                    )
	                       )                                
                    )
                    
        );
        $container = new Zend_Navigation($pages);
        
        $this->bootstrap ( 'layout' );
        $layout = $this->getResource ( 'layout' );
        $view = $layout->getView ();
        $view->getHelper('navigation')->setContainer($container);
    
    }
}

